#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QDebug>
#include <QSerialPort>
QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACE

class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();

protected:
    void paintEvent(QPaintEvent *event) override;

private slots:
    void on_pushButton_2_clicked();
    void serialread();

    void on_pushButton_forward_pressed();

    void on_pushButton_back_pressed();

    void on_pushButton_left_pressed();

    void on_pushButton_Stop_pressed();

    void on_MOD_pressed();

    void on_pushButton_forward_released();

    void on_pushButton_left_released();

    void on_pushButton_back_released();

    void on_pushButton_Right_released();

    void on_pushButton_Right_pressed();

private:
    Ui::Widget *ui;
    QSerialPort *serial10;
    bool serialOpen = false;
    // 模式切换：true为遥控，false为循迹
    bool isRemoteMode = true;
};

#endif // WIDGET_H
